package com.study.Util;


import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class PasswordUtil {

    private static String secret;

    @Value("${password.secret}")
    private static void setSecret(String secret) {
        PasswordUtil.secret = secret;
    }

    public static String encodedPassWord(String passWord){
        String pwd = String.format("%s%s", secret, passWord);
        return DigestUtils.sha256Hex(pwd);
    }
}
